# 使用 Python 3.10 镜像作为基础镜像
FROM python:3.10

ENV ZHUPU=dev

# 设置工作目录为 /app
WORKDIR /app

COPY . /app

RUN pip install --upgrade pip

# 替换 pip 源以加速下载
RUN mkdir -p /etc/pip/ && \
    echo "[global]" > /etc/pip/pip.conf && \
    echo "index-url = https://pypi.tuna.tsinghua.edu.cn/simple" >> /etc/pip/pip.conf && \
    echo "extra-index-url = https://mirrors.aliyun.com/pypi/simple/" >> /etc/pip/pip.conf

# 安装依赖
RUN pip install --no-cache-dir -r requirements.txt

RUN python configs/config.py

RUN echo 'echo ========================================ZHUPU BASH======================================== ' >> /root/.bashrc
RUN echo 'export MY_VARIABLE="some_value"' >> /root/.bashrc
RUN echo 'alias rebuild_db="python /app/tests/scripts.py rebuild_db"' >> /root/.bashrc

# 使用 Uvicorn 启动 FastAPI 应用
# CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
CMD ["sleep", "infinity"]
